feat: add GitHub Copilot API as LLM provider#89
Open
YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
Open
feat: add GitHub Copilot API as LLM provider#89YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
YihanJIANG-lab wants to merge 1 commit intoSakanaAI:mainfrom
Conversation
Add support for using GitHub Copilot's chat completions API as a backend provider, enabling use of models available through Copilot (GPT-4o, Claude, etc.) without requiring separate API keys. Changes: - Add copilot_auth.py: OAuth token to JWT exchange for Copilot API - Add copilot_config.yaml: example configuration for Copilot provider - backend_openai.py: Copilot client creation, rate limiting (3s min interval), Claude compatibility (max_tokens, multi-choice handling) - backend/__init__.py: auto-detect Copilot mode via COPILOT_OAUTH_TOKEN - backend_anthropic.py: pass through to OpenAI backend in Copilot mode - llm.py / vlm.py: Copilot client creation support - token_tracker.py: guard against None token counts - backend/utils.py: PermissionDeniedError in retry exceptions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for using GitHub Copilot's chat completions API as a backend provider, enabling use of GPT-4o, Claude, and other models available through Copilot without requiring separate API keys.
Key changes:
copilot_auth.py: OAuth token → JWT exchange for Copilot API authenticationcopilot_config.yaml: Example configuration for Copilot providerCOPILOT_OAUTH_TOKENenvironment variablemax_tokens, multi-choice response handlingPermissionDeniedErroradded to retry exceptions (some APIs return 403 on quota exhaustion)Nonetoken counts in token tracker